All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class com.sun.java.swing.JSplitPane

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Container
                   |
                   +----com.sun.java.swing.JComponent
                           |
                           +----com.sun.java.swing.JSplitPane

public class JSplitPane
extends JComponent
implements Accessible
JSplitPane is used to divide two (and only two) Components. The two Components are graphically divided based on the look and feel implementation, and the two Components can then be interactively resized by the user.

The two Components can be aligned left to right using JSplitPane.HORIZONTAL_SPLIT, or top to bottom using JSplitPane.VERTICAL_SPLIT. The preferred way to change the size of the Components is to invoke setDividerLocation where location is either the new x or y position, depending on the orientation of the JSplitPane. If one component changes, JSplitPane also attempts to reposition the other component.

To resize the Components to their preferred sizes invoke resetToPreferredSizes.

When the user is resizing the Components the minimum size of the Components is used to determine the maximum/minimum position the Components can be set to. So that if the minimum size of the two components is greater than the size of the splitpane the divider will not allow you to resize it. To alter the minimum size of a JComponent, see JComponent.setMinimumSize.

For the keyboard keys used by this component in the standard Look and Feel (L&F) renditions, see the JSplitPane key assignments.

Warning: serialized objects of this class will not be compatible with future swing releases. The current serialization support is appropriate for short term storage or RMI between Swing1.0 applications. It will not be possible to load serialized Swing1.0 objects with future releases of Swing. The JDK1.2 release of Swing will be the compatibility baseline for the serialized form of Swing objects.

See Also:
setDividerLocation, resetToPreferredSizes, setMinimumSize

Variable Index

 o BOTTOM
Used to add a Component below the other Component.
 o CONTINUOUS_LAYOUT_PROPERTY
Bound property name for continuousLayout.
 o continuousLayout
Whether or not the views are continuously redisplayed while resizing.
 o DIVIDER
Used to add a Component that will represent the divider.
 o DIVIDER_SIZE_PROPERTY
Bound property name for border.
 o dividerSize
Size of the divider.
 o HORIZONTAL_SPLIT
Horizontal split indicates the Components are split along the x axis, eg the two Components will be split one to the left of the other.
 o LAST_DIVIDER_LOCATION_PROPERTY
Bound property for lastLocation.
 o lastDividerLocation
Previous location of the split pane.
 o LEFT
Used to add a Component to the left of the other Component.
 o leftComponent
The left or top component.
 o ONE_TOUCH_EXPANDABLE_PROPERTY
Bound property for oneTouchExpandable.
 o oneTouchExpandable
Is a little widget provided to quickly expand/collapse the split pane?
 o orientation
How the views are split.
 o ORIENTATION_PROPERTY
Bound property name for orientation (horizontal or vertical).
 o RIGHT
Used to add a Component to the right of the other Component.
 o rightComponent
 o TOP
Used to add a Component above the other Component.
 o VERTICAL_SPLIT
Vertical split indicates the Components are split along the y axis, eg the two Components will be split one on top of the other.

Constructor Index

 o JSplitPane()
Returns a new JSplitPane configured to arrange the child components side-by-side horizontally with no continuous layout, using two buttons for the compoents.
 o JSplitPane(int)
Returns a new JSplitPane configured with the specified orientation and no continuous layout.
 o JSplitPane(int, boolean)
Returns a new JSplitPane with the specified orientation and redrawing style.
 o JSplitPane(int, boolean, Component, Component)
Returns a new JSplitPane with the specified orientation and redrawing style, and with the specifiied components.
 o JSplitPane(int, Component, Component)
Returns a new JSplitPane with the specified orientation and with the specifiied components that does not do continuous redrawing.

Method Index

 o addImpl(Component, Object, int)
If constraints identifies the left/top or right/bottom child component, and a component with that identifier was previously added, it will be removed and then comp will be added in its place.
 o getAccessibleContext()
Get the AccessibleContext associated with this JComponent
 o getBottomComponent()
Returns the component below, or to the right of the divider.
 o getDividerLocation()
Returns the location of the divider from the look and feel implementation.
 o getDividerSize()
Returns the size of the divider.
 o getLastDividerLocation()
Returns the last location the divider was at.
 o getLeftComponent()
Returns the component to the left (or above) the divider.
 o getMaximumDividerLocation()
Returns the maximum location of the divider from the look and feel implementation.
 o getMinimumDividerLocation()
Returns the minimum location of the divider from the look and feel implementation.
 o getOrientation()
Returns the orientation.
 o getRightComponent()
Returns the component to the right (or below) the divider.
 o getTopComponent()
Returns the component above, or to the left of the divider.
 o getUI()
Returns the SplitPaneUI that is providing the current look and feel.
 o getUIClassID()
Returns the name of the L&F class that renders this component.
 o isContinuousLayout()
Returns true if the child comopnents are continuously redisplayed and layed out during user intervention.
 o isOneTouchExpandable()
Returns true if the pane provides a UI widget to collapse/expand the divider.
 o paintChildren(Graphics)
Subclassed to message the UI with finishedPaintingChildren after super has been messaged, as well as painting the border.
 o remove(Component)
Removes the child component, component from the pane.
 o remove(int)
Removes the Component at the specified index.
 o removeAll()
Removes all the child components from the receiver.
 o resetToPreferredSizes()
Messaged to relayout the JSplitPane based on the preferred size of the children components.
 o setBottomComponent(Component)
Sets the component below, or to the right of the divider.
 o setContinuousLayout(boolean)
Sets whether or not the child components are continuously redisplayed and layed out during user intervention.
 o setDividerLocation(double)
Sets the divider location as a percentage of the JSplitPane's size.
 o setDividerLocation(int)
Sets the location of the divider.
 o setDividerSize(int)
Sets the size of the divider.
 o setLastDividerLocation(int)
Sets the last location the divider was at to newLastLocation.
 o setLeftComponent(Component)
Sets the component to the left (or above) the divider.
 o setOneTouchExpandable(boolean)
Determines whether the JSplitPane provides a UI widget on the divider to quickly expand/collapse the divider.
 o setOrientation(int)
Sets the orientation, or how the splitter is divided.
 o setRightComponent(Component)
Sets the component to the right (or below) the divider.
 o setTopComponent(Component)
Sets the component above, or to the left of the divider.
 o setUI(SplitPaneUI)
Sets the L&F object that renders this component.
 o updateUI()
Notification from the UIManager that the L&F has changed.

Variables

 o VERTICAL_SPLIT
 public static final int VERTICAL_SPLIT
Vertical split indicates the Components are split along the y axis, eg the two Components will be split one on top of the other.

 o HORIZONTAL_SPLIT
 public static final int HORIZONTAL_SPLIT
Horizontal split indicates the Components are split along the x axis, eg the two Components will be split one to the left of the other.

 o LEFT
 public static final String LEFT
Used to add a Component to the left of the other Component.

 o RIGHT
 public static final String RIGHT
Used to add a Component to the right of the other Component.

 o TOP
 public static final String TOP
Used to add a Component above the other Component.

 o BOTTOM
 public static final String BOTTOM
Used to add a Component below the other Component.

 o DIVIDER
 public static final String DIVIDER
Used to add a Component that will represent the divider.

 o ORIENTATION_PROPERTY
 public static final String ORIENTATION_PROPERTY
Bound property name for orientation (horizontal or vertical).

 o CONTINUOUS_LAYOUT_PROPERTY
 public static final String CONTINUOUS_LAYOUT_PROPERTY
Bound property name for continuousLayout.

 o DIVIDER_SIZE_PROPERTY
 public static final String DIVIDER_SIZE_PROPERTY
Bound property name for border.

 o ONE_TOUCH_EXPANDABLE_PROPERTY
 public static final String ONE_TOUCH_EXPANDABLE_PROPERTY
Bound property for oneTouchExpandable.

 o LAST_DIVIDER_LOCATION_PROPERTY
 public static final String LAST_DIVIDER_LOCATION_PROPERTY
Bound property for lastLocation.

 o orientation
 protected int orientation
How the views are split.

 o continuousLayout
 protected boolean continuousLayout
Whether or not the views are continuously redisplayed while resizing.

 o leftComponent
 protected Component leftComponent
The left or top component.

 o rightComponent
 protected Component rightComponent
 o dividerSize
 protected int dividerSize
Size of the divider.

 o oneTouchExpandable
 protected boolean oneTouchExpandable
Is a little widget provided to quickly expand/collapse the split pane?

 o lastDividerLocation
 protected int lastDividerLocation
Previous location of the split pane.

Constructors

 o JSplitPane
 public JSplitPane()
Returns a new JSplitPane configured to arrange the child components side-by-side horizontally with no continuous layout, using two buttons for the compoents.

 o JSplitPane
 public JSplitPane(int newOrientation)
Returns a new JSplitPane configured with the specified orientation and no continuous layout.

Parameters:
newOrientation - an int specifying the horizontal or vertical orientation
 o JSplitPane
 public JSplitPane(int newOrientation,
                   boolean newContinuousLayout)
Returns a new JSplitPane with the specified orientation and redrawing style.

Parameters:
newOrientation - an int specifying the horizontal or vertical orientation
newContinuousLayout - a boolean, true for the components to redraw continuously as the divider changes position, false to wait until the divider position stops changing to redraw
 o JSplitPane
 public JSplitPane(int newOrientation,
                   Component newLeftComponent,
                   Component newRightComponent)
Returns a new JSplitPane with the specified orientation and with the specifiied components that does not do continuous redrawing.

Parameters:
newOrientation - an int specifying the horizontal or vertical orientation
newContinuousLayout - a boolean, true for the components to redraw continuously as the divider changes position, false to wait until the divider position stops changing to redraw
newLeftComponent - the Component that will appear on the left of a horizontally-split pane, or at the top of a vertically-split pane.
 o JSplitPane
 public JSplitPane(int newOrientation,
                   boolean newContinuousLayout,
                   Component newLeftComponent,
                   Component newRightComponent)
Returns a new JSplitPane with the specified orientation and redrawing style, and with the specifiied components.

Parameters:
newOrientation - an int specifying the horizontal or vertical orientation
newContinuousLayout - a boolean, true for the components to redraw continuously as the divider changes position, false to wait until the divider position stops changing to redraw
newLeftComponent - the Component that will appear on the left of a horizontally-split pane, or at the top of a vertically-split pane.

Methods

 o setUI
 public void setUI(SplitPaneUI ui)
Sets the L&F object that renders this component.

Parameters:
ui - the SplitPaneUI L&F object
See Also:
getUI
 o getUI
 public SplitPaneUI getUI()
Returns the SplitPaneUI that is providing the current look and feel.

Returns:
the SplitPaneUI object that renders this component
 o updateUI
 public void updateUI()
Notification from the UIManager that the L&F has changed. Replaces the current UI object with the latest version from the UIManager.

Overrides:
updateUI in class JComponent
See Also:
updateUI
 o getUIClassID
 public String getUIClassID()
Returns the name of the L&F class that renders this component.

Returns:
"SplitPaneUI"
Overrides:
getUIClassID in class JComponent
See Also:
getUIClassID, getUI
 o setDividerSize
 public void setDividerSize(int newSize)
Sets the size of the divider.

Parameters:
newSize - an int giving the size of the divider in pixels
 o getDividerSize
 public int getDividerSize()
Returns the size of the divider.

Returns:
an int giving the size of the divider in pixels
 o setLeftComponent
 public void setLeftComponent(Component comp)
Sets the component to the left (or above) the divider.

Parameters:
comp - the Component to display in that position
 o getLeftComponent
 public Component getLeftComponent()
Returns the component to the left (or above) the divider.

Returns:
the Component displayed in that position
 o setTopComponent
 public void setTopComponent(Component comp)
Sets the component above, or to the left of the divider.

Parameters:
comp - the Component to display in that position
 o getTopComponent
 public Component getTopComponent()
Returns the component above, or to the left of the divider.

Returns:
the Component displayed in that position
 o setRightComponent
 public void setRightComponent(Component comp)
Sets the component to the right (or below) the divider.

Parameters:
comp - the Component to display in that position
 o getRightComponent
 public Component getRightComponent()
Returns the component to the right (or below) the divider.

Returns:
the Component displayed in that position
 o setBottomComponent
 public void setBottomComponent(Component comp)
Sets the component below, or to the right of the divider.

Parameters:
comp - the Component to display in that position
 o getBottomComponent
 public Component getBottomComponent()
Returns the component below, or to the right of the divider.

Returns:
the Component displayed in that position
 o setOneTouchExpandable
 public void setOneTouchExpandable(boolean newValue)
Determines whether the JSplitPane provides a UI widget on the divider to quickly expand/collapse the divider.

Parameters:
newValue - a boolean, where true means to provide a collapse/expand widget
 o isOneTouchExpandable
 public boolean isOneTouchExpandable()
Returns true if the pane provides a UI widget to collapse/expand the divider.

Returns:
true if the split pane provides a collapse/expand widget
 o setLastDividerLocation
 public void setLastDividerLocation(int newLastLocation)
Sets the last location the divider was at to newLastLocation.

Parameters:
newLastLocation - an int specifying the last divider location in pixels, from the left (or upper) edge of the pane to the left (or upper) edge of the divider
 o getLastDividerLocation
 public int getLastDividerLocation()
Returns the last location the divider was at.

Returns:
an int specifying the last divider location as a count of pixels from the left (or upper) edge of the pane to the left (or upper) edge of the divider
 o setOrientation
 public void setOrientation(int orientation)
Sets the orientation, or how the splitter is divided. The options are:

Parameters:
orientation - an int specifying the orientation
 o getOrientation
 public int getOrientation()
Returns the orientation.

Returns:
an int giving the orientation
See Also:
setOrientation
 o setContinuousLayout
 public void setContinuousLayout(boolean newContinuousLayout)
Sets whether or not the child components are continuously redisplayed and layed out during user intervention.

Parameters:
newContinuousLayout - a boolean, true if the components are continuously redrawn as the divider changes position
 o isContinuousLayout
 public boolean isContinuousLayout()
Returns true if the child comopnents are continuously redisplayed and layed out during user intervention.

Returns:
true if the components are continuously redrawn as the divider changes position
 o resetToPreferredSizes
 public void resetToPreferredSizes()
Messaged to relayout the JSplitPane based on the preferred size of the children components.

 o setDividerLocation
 public void setDividerLocation(double proportionalLocation)
Sets the divider location as a percentage of the JSplitPane's size.

Parameters:
proportionalLocation - a double-precision floating point value that specifies a percentage, from zero (top/left) to 1.0 (bottom/right)
Throws: IllegalArgumentException
if the specified location is < 0 or > 1.0
 o setDividerLocation
 public void setDividerLocation(int location)
Sets the location of the divider. This is passed off to the look and feel implementation.

Parameters:
location - an int specifying a UI-specific value (typically a pixel count)
 o getDividerLocation
 public int getDividerLocation()
Returns the location of the divider from the look and feel implementation.

Returns:
an int specifying a UI-specific value (typically a pixel count)
 o getMinimumDividerLocation
 public int getMinimumDividerLocation()
Returns the minimum location of the divider from the look and feel implementation.

Returns:
an int specifying a UI-specific value for the minimum location (typically a pixel count)
 o getMaximumDividerLocation
 public int getMaximumDividerLocation()
Returns the maximum location of the divider from the look and feel implementation.

Returns:
an int specifying a UI-specific value for the maximum location (typically a pixel count)
 o remove
 public void remove(Component component)
Removes the child component, component from the pane. Resets the leftComponent or rightComponent instance variable, as necessary.

Parameters:
component - the Component to remove
Overrides:
remove in class Container
 o remove
 public void remove(int index)
Removes the Component at the specified index. Updates the leftComponent and rightComponent ivars (instance variables) as necessary, and then messages super.

Parameters:
index - an int specifying the component to remove, where 0 specifies the left/top component and 1 specifies the bottom/right component
Overrides:
remove in class Container
 o removeAll
 public void removeAll()
Removes all the child components from the receiver. Resets the leftComonent and rightComponent instance variables.

Overrides:
removeAll in class Container
 o addImpl
 protected void addImpl(Component comp,
                        Object constraints,
                        int index)
If constraints identifies the left/top or right/bottom child component, and a component with that identifier was previously added, it will be removed and then comp will be added in its place. If constraints is not one of the known identifers the layout manager may throw an IllegalArgumentException.

The possible constraints objects (Strings) are:

If the constraints object is null, the component is added in the first available position (left/top if open, else right/bottom).

Parameters:
comp - the component to add
constraints - an Object specifying the layout constraints (position) for this component
index - an int specifying the index in the container's list.
Throws: IllegalArgumentException
thrown if the constraints object does not match an existing component
Overrides:
addImpl in class Container
See Also:
addImpl
 o paintChildren
 protected void paintChildren(Graphics g)
Subclassed to message the UI with finishedPaintingChildren after super has been messaged, as well as painting the border.

Parameters:
g - the Graphics context within which to paint
Overrides:
paintChildren in class JComponent
 o getAccessibleContext
 public AccessibleContext getAccessibleContext()
Get the AccessibleContext associated with this JComponent

Returns:
the AccessibleContext of this JComponent
Overrides:
getAccessibleContext in class JComponent

All Packages  Class Hierarchy  This Package  Previous  Next  Index